package com.example.employeejdbc.controller;

import com.example.employeejdbc.model.Employee;
import com.example.employeejdbc.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class EmployeeController {
    @Autowired
    EmployeeService empService;


    @GetMapping("/hello")
    public List<Employee> hello(){
        return new ArrayList<>();
    }
    @GetMapping("/all")
    public List<Employee> getAllEmployees(){
        return empService.getAllEmployees();
    }

    @PostMapping("/insert")
    public void insertEmployee(@RequestBody Employee employee){
        empService.insertEmployee(employee);
    }
}

